/*
 * @Author: Wxx
 * @Date: 2022-02-28 14:15:19
 * @LastEditors: Wxx
 * @LastEditTime: 2022-02-28 14:48:23
 * @Description:
 */
import React, { createRef, useState } from "react";

export default function ToDoList() {
  const [list, setList] = useState<string[]>([]);

  const myRef = createRef<HTMLInputElement>();
  return (
    <div>
      <input ref={myRef} />
      <button
        onClick={() => {
          setList([...list, (myRef.current as HTMLInputElement).value]);
        }}
      >
        click
      </button>
      {list.map((item) => (
        <li key={item}>{item}</li>
      ))}
    </div>
  );
}
